all stats

soup girl's stats

guessed the most

namecorrect guessesgames togetherratio
seshoumara661.000
olus20006110.545
Olivia4100.400
moshikoi270.286
JJRubes140.250
olive140.250
LyricLy3140.214
razetime180.125
Palaiologos1100.100
luatic040.000
IFcoltransG070.000

were guessed the most by

namecorrect guessesgames togetherratio
kimapr140.250
olive140.250
LyricLy4160.250
JJRubes150.200
luatic160.167
olus20002120.167
IFcoltransG160.167
moshikoi170.143
Palaiologos190.111
Olivia1100.100
seshoumara060.000
taswelll050.000
razetime0100.000

entries

round #56

submitted at
1 like

guesses
comments 0

post a comment


cg.hs ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{-# LANGUAGE ViewPatterns #-}

module CG where

import Control.Applicative
import Control.Monad
import Control.Monad.Trans.State.Lazy
import Data.List
import Data.Maybe

data R = E | F | C Char | R :|: R | R :&: R | K R deriving (Eq, Ord)

-- i know lyric ly will guess me but she always does
instance Show R where
  show E = ""
  show F = "\a"
  show (C c) = [c]
  show ((show -> "\a") :|: b) = show b
  show ((show -> a) :|: _) = a
  show ((show -> "\a") :&: _) = "\a"
  show (_ :&: (show -> "\a")) = "\a"
  show ((show -> a) :&: (show -> b)) = a ++ b
  show (K _) = ""

type Parser = StateT String Maybe

a = StateT uncons
b = StateT $ maybe (Just ((),[])) (const Nothing) . uncons
c = flip mfilter (StateT uncons) . (==)
d = traverse c
e = asum . map c
f = mfilter (/= E)
g = fromJust . evalStateT (h <* b)
h = foldl (:|:) <$> i <*> many (c '|' *> i)
i = foldl (:&:) <$> j <*> many (f j)
j = (K <$> (f k <* c '*')) <|> k
k = (c '(' *> h <* c ')') <|> l
l = m <|> n <|> o <|> p
m = F <$ d "[]"
n = C <$> e ([' '..'~'] \\ "()[]|*\\")
o = C <$> (c '\\' *> a)
p = E <$ d ""

main = interact $ unlines . map (show . g) . lines

round #45

submitted at
0 likes

guesses
comments 0

post a comment


4.py ASCII text, with CRLF line terminators
1
2
3
4
5
6
import random
if input() == 's': input()
while True:
    # the right column is cursed, we do not go there
    print(random.randint(1,6))
    input()

round #43

submitted at
0 likes

guesses
comments 1
LyricLy

Written out with signs. Formatted

/* I mean it's not
like anybody was
going to compile
it anyway lmao */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
void draw(int Rn,
int Rd,int rn,int rd,
int dn,int dd,char*
fn){int an=Rn*rd,
ad=Rd*rn,ae=ad;
double bn=an-ad;
while(ae)ae^=an
^=ae^=an%=ae;
ad/=an;double bd
=rd*Rd,w=bn/bd,
v=w*rd/rn,d=dn/
dd,m=512.0/(Rn*dd
*rd+Rd*dn*rd-Rd*
dd*rn)*Rd*dd*rd;
unsigned char*img
=calloc(1,1049600
);for(double t=0;t
<6.284*ad;t+=
0.0001){int x=(w*
cos(t)+d*cos(v*t))
*m-1; int y=(w*sin(
t)-d*sin(v*t))*m-1;
img[x-1024*y+
523776]=1;}FILE*
fp=fopen(fn,"w");
fputs("P3 1024 1"
"024 255 ",fp);for
(int i=0;i<1048576;
i++)fputs(img[i]?
"0 0 0 ":"255 255"
" 255 ",fp);fclose(
fp);free(img);}int
main(){draw(5,1,3,1
,5,1,"test1.ppm");
draw(5,1,31,10,5,1,
"test2.ppm");}
// code guessing
int main(){draw(5,1
,3,1,5,1,"test1.ppm"
);draw(5,1,31,10,
5,1,"test2.ppm");}

post a comment


spirograph.tar.mp4.bz3.zip Zip archive data, at least v2.0 to extract, compression method=store
dir Code Guessing
dir region
r.-1.-1.mca data
r.-1.0.mca data
r.0.-1.mca data
r.0.0.mca Intel ia64 COFF executable, no relocation info, no line number info, stripped, 334 sections, symbol offset=0x1bf0200, 16973824 symbols, created Sun Sep 6 19:12:00 1970, 1st section name ""
level.dat gzip compressed data, from Unix
1
cg: couldn't decode file contents

round #40

submitted at
1 like

guesses
comments 0

post a comment


musi.py ASCII text, with CRLF line terminators
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
# ni li ken pakala. mi pana e jaki ala.
# musi ni li jaki, sina wile ala e jaki ante.

def sike_ante(nanpa):
    pini = set()
    for open in filter(lambda ijo: ijo not in pini, range(15)):
        lon = nanpa[open]
        sike_ni = [open]
        while lon != open:
            pini.add(lon)
            sike_ni.append(lon)
            lon = nanpa[lon]
        yield sike_ni

def sike_tu(sike):
    for sike_ni in sike:
        pini, *sike_ni = sike_ni
        for nanpa in sike_ni:
            yield (pini, nanpa)
            pini = nanpa

def sike_tu_wan(sike):
    for (a,b) in sike:
        (c,d) = next(sike)
        if a == c:
            yield (a,d,b)
        elif a == d:
            yield (a,c,b)
        elif b == c:
            yield (b,d,a)
        elif b == d:
            yield (b,c,a)
        else:
            yield from [(a,b,c),(b,c,d)]

def sike_wan_i_j(sike):
    for (a,b,c) in sike:
        if a == 0:
            yield (b,c)
        elif b == 0:
            yield (c,a)
        elif c == 0:
            yield (a,b)
        else:
            yield from [(a,b),(b,c)]

def sike_wan_tu_i(sike):
    for (i,j) in sike:
        if i == 1:
            yield j
        elif j == 1:
            yield from [i,i]
        else:
            yield from [j,j,i,j]

def musi(nanpa):
    # nanpa ala li tawa leko pini
    nasin = [3, 2, 1, 0, 4, 5, 6, 7, 11, 10, 9, 8, 12, 13, 14, 15]
    open = "RRRULLLURRRULLL"[nasin.index(nanpa.index(0)):]
    nanpa = [nanpa[i] for i in nasin]
    nanpa = [nasin[nanpa-1] for nanpa in nanpa if nanpa]

    # o pali e sike ante
    sike = sike_ante(nanpa)
    
    # o pali e sike pi nanpa tu
    sike = sike_tu(sike)

    # o ante tawa sike pi nanpa tu wan
    sike = sike_tu_wan(sike)

    # o ante tawa sike sama (0 i j)
    sike = sike_wan_i_j(sike)

    # o ante tawa sike sama (0 1 i)
    sike = sike_wan_tu_i(sike)

    # o ante tawa tawa leko
    lipu_leko = {
        2: "DRRDDLURULLDRDLUUU",
        3: "DRRDDRULDLURRDLUULLDRDLUUU",
        4: "DRRDRDLLURDRULULLDRDLUUU",
        5: "RDDRULLDRDLUURRDLUUL",
        6: "DDRDLUUU",
        7: "RDDDLURUUL",
        8: "RDDLURDDLURULDRUUL",
        9: "DRDLURDDLUURDLUU",
        10: "RDRDLULDRDLUURDRULUL",
        11: "DRDDRUURDLLURDLULDRRRULDDLLUUU",
        12: "RRRDLULDRDLULDRDLUURDRULURDRULLL",
        13: "RRDLULDRDLURDDLUURDLUURDRULL",
        14: "RDLURDDLURDDLUURDLUURDLU"
    }
    pali = ""
    for i in sike:
        pali = lipu_leko[i] + pali

    # o weka e tawa ike
    for tawa in lipu_leko.values():
        pali = pali.replace(tawa*2 , tawa[::-1].translate({68:85,85:68,76:82,82:76}))
    while "UD" in pali or "DU" in pali or "LR" in pali or "RL" in pali:
        pali = pali.replace("UD", "").replace("DU", "") \
                   .replace("LR", "").replace("RL", "")

    return open + pali

round #39

submitted at
1 like

guesses
comments 0

post a comment


^_^.png PNG image data, 307 x 180, 8-bit/color RGBA, non-interlaced
flak.py ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
function toggle(s, t, c)
   return c(0, t, s)
end

function one(s, t, c)
   return c(1, s, t)
end

function height(s, t, c)
   return c(#s, s, t)
end

function void(n)
   return function (s, t, c)
      return n(s, t, function (x, y, z)
         return c(0, y, z)
      end)
   end
end

function neg(n)
   return function (s, t, c)
      return n(s, t, function (x, y, z)
         return c(-x, y, z)
      end)
   end
end

function pop(s, t, c)
   local u = {}
   for i = 2, #s do
      u[i-1] = s[i]
   end
   return c(s[1], u, t)
end

function loop(n)
   return function (s, t, c)
      if #s == 0 or s[1] == 0 then
         return c(0, s, t)
      else
         return concat(n, loop(n))(s, t, c)
      end
   end
end

function concat(m, n)
   return function (s, t, c)
      return m(s, t, function (x, y, z)
         return n(y, z, function (p, q, r)
            return c(x+p, q, r)
         end)
      end)
   end
end

function push(n)
   return function (s, t, c)
      return n(s, t, function (x, y, z)
         local u = {x}
         for i = 1, #y do
            u[i+1] = y[i]
         end
         return c(x, u, z)
      end)
   end
end

function parse(f, s, c)
   local nilads = { ['()']=one, ['[]']=height, ['{}']=pop, ['<>']=toggle }
   local monads = { ['(']=push, ['[']=neg, ['{']=loop, ['<']=void }
   local nilad = nilads[string.sub(s, 1, 2)]
   local monad = monads[string.sub(s, 1, 1)]
   if nilad then
      return parse(concat(f, nilad), string.sub(s, 3), c)
   elseif monad then
      return parse(void(one), string.sub(s, 2), function (g, s)
         return parse(concat(f, monad(g)), string.sub(s, 2), c)
      end)
   else
      return c(f, s)
   end
end

function brainflak(s, n)
   s = string.gsub(s, "[^%[%](){}<>]", "")
   s, t = parse(void(one), s, function (f, s) return f, s end)
   return s(n, {}, function (x, y, z) return y end)
end

round #38

submitted at
0 likes

guesses
comments 0

post a comment


entrée.c ASCII text, with CRLF line terminators
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// Code by SoundOfSpouting#6980 (UID: 151149148639330304)

/*
    I CAN'T BELIEVE IT'S NOT DESMOS.c
    (c) oliriclusgos 2023

    This calculator works in three stages.  In the first,
    we convert the source text into a tokenised form in
    which operators are stored with their precedence
    using only a single byte.  This is easy to do, as
    fortunately the digit characters 0-9 and the operators
    + - * / are all different modulo 16.  As this leaves
    4 bits to store precedence, this approach is limited
    to a maximum of 16 spaces between operators and their
    operands.  If you need more, then may God help you.
    This transformation is done destructively, for two
    reasons, the first being: I wanted to.
*/
int lex(char *expr) {
/*
    As 0x00 is a valid token, the usual C-string API
    will not be applicable to this representation.
    Because of this, the number of tokens scanned must
    be recorded and returned.
*/
    int tokens = 0;
/*
    `c` will be used to store the current character
    being scanned over, and `spaces` (which the attentive
    reader may have ascertained) will keep track of how
    many spaces have been read.  `scan` will be used to
    scan the string, and `expr` will be repurposed to
    overwrite the string with the new tokens.

    As each individual token consists of at least one
    source characters, `expr` will never overwrite
    characters that have yet to be read.
*/
    char c, spaces, *scan=expr;
/*
    We assume the source expression is syntactically valid,
    and that there is no trailing whitespace.  Thus, the only
    necessary test for a null terminator is between tokens.
*/
    while (*scan) {
        spaces = 0;
/*
    Now we scan past all the spaces, keeping count of them.
    When this loop ends, `c` will contain the next token
    character, and `scan` will point to the character after.
*/
        while ((c=*scan++) == ' ')
            spaces++;
/*
    Next, we construct the token.  We replace the high 4 bits
    of the token character with the number of spaces, and store
    it at the 'write' head.
*/
        *expr++ = (c&0xF)|(spaces<<4);
/*
    Now that the token has been scanned, as we are assuming the
    expression is valid, we can safely skip past the spaces on
    the right-hand side, and increment the token counter, to
    indicate that a token has been scanned.  We do this because
    a token has been scanned.
*/
        scan += spaces;
        tokens++;
    }
/*
    Since the loop has ended, we have scanned all available tokens
    in the source expression.  Since we need to return the number
    of tokens scanned, we return the value of the variable `tokens`,
    because the value of the variable `tokens` happens to be equal
    to the number of tokens we've scanned, for some reason.
*/
    return tokens;
}

/*
    This condensed representation is useful, but is not yet
    easily executable.  In order to remedy this, w
*/

void m(char *e, int o, int w) {
    if (o==w) return;
    int ow=o;
    for (int mr=o;w>mr++;mr++)
      if ((mr[e]>>4)>=(e[ow]>>4))
        ow=mr;
    for (int r=ow;r>o;r--)
        e[r]^=e[r-1]^=e[r]^=e[r-1];
    m(e,-~o,ow);
    m(e,-~ow,w);
}

/*
    e transform the

    oh
    what

    uh, that's that sorted.

    rpn would have been nice but we
    can use the call stack ig
*/

int vm(char *expr) {
/*
    if vm is called with 0, the program will
    resume from the next unread character
*/
    static char *state;
    if (expr) state = expr;
/*
    ive lost steam with the comments icl
    is anyone still reading at this point
*/
    switch (*state++ & 0xF) {
        case 0xA: return vm(0) * vm(0);
        case 0xB: return vm(0) + vm(0);
        case 0xD: return vm(0) - vm(0);
        case 0xF: return vm(0) / vm(0);
        default: return *(state-1);
    }
/*
    https://web.archive.org/web/20090903184346/http://www.bobbemer.com/BRACES.HTM
*/
}

/*
    putting it all together, using a copy
    of the original string since the evaluation
    mutates the source.
*/

int entry(char *expr) {
    char *copy = malloc(strlen(expr)+1);
    strcpy(copy, expr);
    int length = lex(copy);
    m(copy, 0, length-1);
    int val = vm(copy);
    free(copy);
    return val;
}

/*
    i should do something funny here but i think i'll sleep instead
*/

round #37

submitted at
0 likes

guesses
comments 0

post a comment


pipe.hs ASCII text
1
2
3
4
5
6
7
{-# LANGUAGE LambdaCase #-}

f x = \case { 0 -> x; y -> y }
entry x = f <*> (mod x . pred)

-- better code omitted
-- no time :(

round #34

submitted at
3 likes

guesses
comments 0

post a comment


HiTB.c a /usr/bin/vim -s script executable (binary data)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/vim -s
:inoremap ^ <Esc>
i

from sys import stdin, stdout

def fizz(s): stdout.write("Fizz " + s); return fuzz
def fuzz(s): stdout.write("Fuzz " + s); return fozz
def fozz(s): stdout.write("Fozz " + s); return fizz

f = fuzz
for line in stdin: f = f(line)

use std::io::prelude::*;

fn main() {
  for l in std::io::stdin().lock().lines().map(|l| l.unwrap()) {
    println!("{} {}", l.replace("o", "u"), l.chars().last().unwrap())
  }
}

s/[05]$/Buzz/
s/[^z]$/Bizz/

data F = Fizz Int B | Fuzz Int B deriving Read
data B = Buzz | Bizz deriving Read

instance Show F where
  show (Fizz n Buzz) = "FizzBuzz"
  show (Fizz n Bizz) = "Fizz"
  show (Fuzz n Buzz) = "Buzz"
  show (Fuzz n Bizz) = show n

main :: IO ()
main = interact $ unlines . map show . map (read :: String -> F) . lines

^
:3,10w! 1.py
:12,18w! 2.rs
:20,21w! 3.s
:23,33w! 4.hs
:!rustc 2.rs
cgg1qqYpq98@q:%!python3 1.py | ./2 | sed -f 3.s | runghc 4.hs

round #32

submitted at
1 like

guesses
comments 0

post a comment


maze.c ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<stdio.h>
#include<stdlib.h>
#define	f	for

(*p)();(*r)();(*q)();main(){srand(time(0));char
*
z,x[8*8]={1},y[8*8],n=5*5-2,o=2*5,O=4*8,*s,N= \
5                                             \
*9+1,i,j,k,l[8* 8 * 8 * 8 ] , e [8*8*8*8]="#i \
n               c l u d e < s t d             \
io.h>%c#inc l ude<stdlib.h>%c#def i ne%cf%cfo \
r           % c                   % c         \
(*p)();(* r)();(*q)();main(){srand(ti me(0)); \
c         h                           a       \
r*z,x[8*8 ]={1},y[8*8],n=5*5-2,o=2*5, O=4*8,* \
s         ,                           N       \
=5*9+1, i,j,k,l[8*8*8*8],e[8*8*8*8]=%c% s%c;q \
(       l                               ,     \
e,o,o,9 ,9,o, o , O+2,e,O+2); z = s=l;f (;*z< \
O       +     1 ; z           = z +     1     \
);f(;*s =*z;) { s =s+1;z=z+1; f ( ;!(*z -O);z \
=       z     + 1 )           ; } z     =     \
l;f(s=z +N+N+ 7 ; z<s;z=z+1)p ( * z);p( o);p( \
*       z     ) ; z           = z +     1     \
;p(o);f(i =1;i<n;i=i+ 1 ) {y[0]=i<4*5 +2;f(j= \
1         ;           j < N           ;       \
j=j+2){ x [j+ 1]=1;y[j]=0;y[j+1]= !(x [ j]=j< \
5       * 9   ?                   r   ( )     \
%2:0);} s=x;f ( k = 0 ; k < 2 ; k =k+1) {f(j= \
0       ;     j < N ; j = j + 1 ) p     (     \
s[j]?*z :O),z=z +s[ j]; p(N +N) ;p(o);s =y;}} \
f       (       s   =   z   +   N       +     \
1;z<s;z=z + 1)p(* z ) ; p ( o );}(* p )()=put \
c         h a     r ; ( * r ) (     ) =       \
rand;(* q ) ( ) =sprintf;";q(l, e , o , o,9,9 \
,       o , o , O               + 2 , e ,     \
O+2); z=s = l ; f ( ; * z < O + 1 ; z =z+ 1); \
f     (   ; * s = * z ; ) { s = s + 1 ;   z   \
=z+ 1 ;f( ;!(*z -O);z=z +1);}z= l;f(s =z+ N + \
N   + 7   ;     z       <       s     ;   z = \
z+1 )p(*z); p(o); p ( *z) ; z =z+1; p(o);f( i \
=   1       ;     i < n   ; i =     i       + \
1 ){y [ 0 ]=i < 4 *5+2; f(j=1 ; j <N; j =j+2) \
{ x   [ j +   1 ] =     1     ; y [   j ]     \
= 0;y[j+1]= !(x[j ]=j<5*9?r() %2:0) ;}s=x;f(k \
= 0         ;     k           <     2         \
; k=k+1){f(j= 0;j < N;j=j+1 ) p(s [j]?*z:O),z \
= z           +   s [       j ]   ;           \
p(N +N);p(o );s=y ;}}f(s=z+N+ 1;z<s ;z=z+1) p \
    (       *     z           )     ;       p \
(o);}(*p)()=putchar;(*r)()=rand;(*q)()=sprintf;

round #31

submitted at
4 likes

guesses
comments 0

post a comment


codetta.py ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from prelude import p

p.append(
     ['defun', 'entryo', ['xs', 'ys'],
      ['conde', [['nullo', 'xs'], ['nullo', 'ys']],
                [['fresh', ['xa', 'xd', 'ya', 'yd'],
                  ['conso', 'xa', 'xd', 'xs'],
                  ['conso', 'ya', 'yd', 'ys'],
                  ['entryo', 'xd', 'yd'],
                  ['in', 'ya', 'xa'],
                  ['lambda', ['s/c'], 
                   ['if', ['null?', ['pull', [['in', 'ya', 'yd'], 's/c']]],
                          ['unit', 's/c'],
                          'mzero']]]]]],
)
encore.py ASCII text
1
2
import codetta
from theonewithentry import entry
mesanoncyclic.py ASCII text
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
from prelude import p as Prelude

FalseValue = '#f'
TrueValue = '#t'
NilValue = 'nil'
QuoteSymbol = 'quote'
IfSymbol = 'if'
BeginSymbol = 'begin'
SetSymbol = 'set!'
DefineSymbol = 'define'
LambdaSymbol = 'lambda'
MuSymbol = 'mu'


def Cons(X, Y):
    return [X, Y]

def Car(X):
    return X[0]

def Cdr(X):
    return X[1]

def Add(X, Y):
    return X + Y

def Sym(X):
    return str(X)

def Eq(X, Y):
    if X is Y:
        return TrueValue
    else:
        return FalseValue

def Pair(X):
    if isinstance(X, list):
        return TrueValue
    else:
        return FalseValue
    

def EvaluateIfExpression(Predicate, Consequent, Alternative, Environment, Continuation):
    def IfContinuation(Value, _, __):
        if Value == FalseValue:
            return Alternative, Environment, Continuation
        else:
            return Consequent, Environment, Continuation
    return Predicate, Environment, IfContinuation

def EvaluateBeginExpression(Body, Environment, Continuation):
    def BeginContinuation(_, __, ___):
        return EvaluateBeginExpression(Body[1], Environment, Continuation)
    if Cdr(Body) == NilValue:
        return Car(Body), Environment, Continuation
    else:
        return Car(Body), Environment, BeginContinuation

def EvaluateSetExpression(Name, Expression, Environment, Continuation):
    def SetContinuation(Value, _, __):
        Environment.Set(Name, Value)
        return NilValue, Environment, Continuation
    return Expression, Environment, SetContinuation

def EvaluateDefineExpression(Name, Expression, Environment, Continuation):
    def DefineContinuation(Value, _, __):
        Environment.Define(Name, Value)
        return NilValue, Environment, Continuation
    return Expression, Environment, DefineContinuation

def EvaluateApplication(FunctionExpression, ArgumentExpressions, Environment, Continuation):
    def ApplicationContinuation(Value, _, __):
        return Value(ArgumentExpressions, Environment, Continuation)
    return FunctionExpression, Environment, ApplicationContinuation

def EvaluateLambdaAbstraction(Parameters, Body, EnclosingEnvironment, Continuation):
    def Function(ArgumentExpressions, CallingEnvironment, CallContinuation):
        def ParameterContinuation(ArgumentExpressions, ArgumentValues):
            if ArgumentExpressions == NilValue:
                EnvironmentFrame = {}
                ParameterTraverse = Parameters
                while isinstance(ParameterTraverse, list):
                    EnvironmentFrame[Car(ParameterTraverse)] = Car(ArgumentValues)
                    ArgumentValues = ArgumentValues[1:]
                    ParameterTraverse = Cdr(ParameterTraverse)
                if ParameterTraverse != NilValue:
                    CollectedArguments = NilValue
                    for Argument in reversed(ArgumentValues):
                        CollectedArguments = Cons(Argument, CollectedArguments)
                    EnvironmentFrame[ParameterTraverse] = CollectedArguments
                return EvaluateBeginExpression(Body,
                                               EnclosingEnvironment.Extend(EnvironmentFrame),
                                               CallContinuation)
            else:
                def ArgumentContinuation(Value, _, __):
                    return ParameterContinuation(Cdr(ArgumentExpressions),
                                                 [*ArgumentValues, Value])
                return Car(ArgumentExpressions), CallingEnvironment, ArgumentContinuation
        return ParameterContinuation(ArgumentExpressions, [])
    return Function, EnclosingEnvironment, Continuation

def EvaluateMuAbstraction(Parameters, Body, EnclosingEnvironment, Continuation):
    def Macro(ParameterExpressions, CallingEnvironment, CallContinuation):
        ParameterTraverse = Parameters
        EnvironmentFrame = {}
        while isinstance(ParameterTraverse, list):
            EnvironmentFrame[Car(ParameterTraverse)] = Car(ParameterExpressions)
            ParameterTraverse = Cdr(ParameterTraverse)
            ParameterExpressions = Cdr(ParameterExpressions)
        if ParameterTraverse != NilValue:
            EnvironmentFrame[ParameterTraverse] = ParameterExpressions
        def EvalContinuation(Value, _, __):
            return Value, CallingEnvironment, CallContinuation
        return EvaluateBeginExpression(Body,
                                       EnclosingEnvironment.Extend(EnvironmentFrame),
                                       EvalContinuation)
    return Macro, EnclosingEnvironment, Continuation

def MakePrimitive(NativeFunction):
    def Function(ParameterExpressions, CallingEnvironment, CallContinuation):
        def PrimitiveParameterContinuation(ParameterExpressions, ArgumentValues):
            if ParameterExpressions == NilValue:
                return CallContinuation(NativeFunction(*ArgumentValues),
                                        CallingEnvironment,
                                        CallContinuation)
            else:
                def PrimitiveArgumentContinuation(Value, _, __):
                    return PrimitiveParameterContinuation(Cdr(ParameterExpressions),
                                                          [*ArgumentValues, Value])
                return Car(ParameterExpressions), CallingEnvironment, PrimitiveArgumentContinuation
        return PrimitiveParameterContinuation(ParameterExpressions, [])
    return Function


class Environment:
    def __init__(Self, Parent=None, Bindings=None):
        if Bindings == None:
            Bindings = {}
        Self.Parent = Parent
        Self.Bindings = Bindings

    def Get(Self, Name):
        while Self != None:
            if Name in Self.Bindings:
                return Self.Bindings[Name]
            Self = Self.Parent

    def Set(Self, Name, Value):
        while Self != None:
            if Name in Self.Bindings:
                Self.Bindings[Name] = Value
                return
            Self = Self.Parent

    def Define(Self, Name, Value):
        Self.Bindings[Name] = Value

    def Extend(Self, Bindings):
        return Environment(Self, Bindings)


def ReturnContinuation(Expression, Environment, Continuation):
    return Expression, None, None


def Evaluate(Expression, Environment, Continuation):
    while Continuation != None:
        if isinstance(Expression, str):
            Expression, Environment, Continuation = Continuation(Environment.Get(Expression),
                                                                 Environment, Continuation)
        elif not isinstance(Expression, list):
            Expression, Environment, Continuation = Continuation(Expression,
                                                                 Environment,
                                                                 Continuation)
        elif Car(Expression) == QuoteSymbol:
            Quotation = Car(Cdr(Expression))
            Expression, Environment, Continuation = Continuation(Quotation,
                                                                 Environment,
                                                                 Continuation)
        elif Car(Expression) == IfSymbol:
            Predicate = Car(Cdr(Expression))
            Consequent = Car(Cdr(Cdr(Expression)))
            Alternative = Car(Cdr(Cdr(Cdr(Expression))))
            Expression, Environment, Continuation = EvaluateIfExpression(Predicate,
                                                                         Consequent,
                                                                         Alternative,
                                                                         Environment,
                                                                         Continuation)
        elif Car(Expression) == BeginSymbol:
            Body = Cdr(Expression)
            Expression, Environment, Continuation = EvaluateBeginExpression(Body,
                                                                            Environment,
                                                                            Continuation)
        elif Car(Expression) == SetSymbol:
            Name = Car(Cdr(Expression))
            Value = Car(Cdr(Cdr(Expression)))
            Expression, Environment, Continuation = EvaluateSetExpression(Name,
                                                                          Value,
                                                                          Environment,
                                                                          Continuation)
        elif Car(Expression) == DefineSymbol:
            Name = Car(Cdr(Expression))
            Value = Car(Cdr(Cdr(Expression)))
            Expression, Environment, Continuation = EvaluateDefineExpression(Name,
                                                                             Value,
                                                                             Environment,
                                                                             Continuation)
        elif Car(Expression) == LambdaSymbol:
            Parameters = Car(Cdr(Expression))
            Body = Cdr(Cdr(Expression))
            Expression, Environment, Continuation = EvaluateLambdaAbstraction(Parameters,
                                                                              Body,
                                                                              Environment,
                                                                              Continuation)
        elif Car(Expression) == MuSymbol:
            Parameters = Car(Cdr(Expression))
            Body = Cdr(Cdr(Expression))
            Expression, Environment, Continuation = EvaluateMuAbstraction(Parameters,
                                                                          Body,
                                                                          Environment,
                                                                          Continuation)
        else:
            Applicant = Car(Expression)
            Arguments = Cdr(Expression)
            Expression, Environment, Continuation = EvaluateApplication(Applicant,
                                                                        Arguments,
                                                                        Environment,
                                                                        Continuation)
    return Expression


def Consify(List):
    if type(List) != list:
        return List
    if List[-2:-1] == [...]:
        ConsList = List[-1]
        StartIndex = -3
    else:
        ConsList = NilValue
        StartIndex = -1
    for Element in List[StartIndex::-1]:
        ConsList = Cons(Consify(Element), ConsList)
    return ConsList

def Flatten(List, Recursing=False):
    if List == NilValue:
        if Recursing:
            return []
        else:
            return NilValue
    elif type(List) != list:
        if Recursing:
            return [..., List]
        else:
            return List
    else:
        return [Flatten(Car(List))] + Flatten(Cdr(List), Recursing=True)


def AnyLisp(Expression):
    return Flatten(Evaluate(Consify(Expression), GlobalEnvironment, ReturnContinuation))

GlobalEnvironment = Environment().Extend({ 
    'cons':         MakePrimitive(Cons),
    'car':          MakePrimitive(Car),
    'cdr':          MakePrimitive(Cdr),
    'eq?':          MakePrimitive(Eq),
    '+':            MakePrimitive(Add),
    'pair?':        MakePrimitive(Pair),      
    'sym':          MakePrimitive(Sym),
})

AnyLisp(Prelude)
prelude.py ASCII text
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
def q(x): return ['quote', x]
def qq(x): return ['quasiquote', x]
def uq(x): return ['unquote', x]
def uqs(x): return ['unquote-splicing', x]

p = ['begin',
     ['define', 'nil', q('nil')],
     ['define', '#t', q('#t')],
     ['define', '#f', q('#f')],
     
     ['define', 'list', ['lambda', 'x', 'x']],
     
     ['define', 'defun', ['mu', ['name', 'params', ..., 'body'],
                          ['list', q('define'),
                                   'name',
                                   ['cons', q('lambda'), ['cons', 'params', 'body']]]]],

     ['define', 'defmac', ['mu', ['name', 'params', ..., 'body'],
                          ['list', q('define'),
                                   'name',
                                   ['cons', q('mu'), ['cons', 'params', 'body']]]]],

     ['defun', 'caar', ['x'], ['car', ['car', 'x']]],
     ['defun', 'cadr', ['x'], ['car', ['cdr', 'x']]],
     ['defun', 'cdar', ['x'], ['cdr', ['car', 'x']]],
     ['defun', 'cddr', ['x'], ['cdr', ['cdr', 'x']]],
     ['defun', 'cadar', ['x'], ['car', ['cdr', ['car', 'x']]]],

     ['defun', 'null?', ['x'], ['eq?', 'x', 'nil']],
     
     ['defun', 'length', ['x'],
      ['defun', 'length*', ['x', 'a'],
       ['if', ['pair?', 'x'],
              ['length*', ['cdr', 'x'], ['+', 'a', 1]],
              'a']],
      ['length*', 'x', 0]],
     
     ['defun', 'reverse', ['x'],
      ['defun', 'reverse*', ['a', 'b'],
       ['if', ['pair?', 'a'],
              ['reverse*', ['cdr', 'a'], ['cons', ['car', 'a'], 'b']],
              'b']],
      ['reverse*', 'x', 'nil']],
     
     ['defun', 'append', ['a', 'b'],
      ['defun', 'append*', ['a', 'b'],
       ['if', ['pair?', 'a'],
              ['append*', ['cdr', 'a'], ['cons', ['car', 'a'], 'b']],
              'b']],
      ['append*', ['reverse', 'a'], 'b']],

     ['defun', 'map', ['f', 'x'],
      ['defun', 'map*', ['f', 'x', 'z'],
       ['if', ['pair?', 'x'],
              ['map*', 'f', ['cdr', 'x'], ['cons', ['f', ['car', 'x']], 'z']],
              'z']],
      ['map*', 'f', ['reverse', 'x'], 'nil']],

     
     ['defmac', 'quasiquote', ['x'],
      ['defun', 'qq', ['x'],
       ['if', ['pair?', 'x'],
              ['if', ['eq?', ['car', 'x'], q('unquote')],
                     ['cadr', 'x'],
                     ['if', ['pair?', ['car', 'x']],
                            ['if', ['eq?', ['caar', 'x'], q('unquote-splicing')],
                                   ['list', q('append'), ['cadar', 'x'], ['qq', ['cdr', 'x']]],
                                   ['list', q('cons'), ['qq', ['car', 'x']], ['qq', ['cdr', 'x']]]],
                            ['list', q('cons'), ['qq', ['car', 'x']], ['qq', ['cdr', 'x']]]]],
                    
              ['list', q('quote'), 'x']]],
      ['qq', 'x']],

     ['defmac', 'let', ['bindings', ..., 'body'],
      qq([['lambda', uq(['map', 'car', 'bindings']), uqs('body')],
          uqs(['map', 'cadr', 'bindings'])])],

     ['defmac', 'cond', 'clauses',
      ['defun', 'cond*', ['clauses'],
       ['if', ['eq?', ['caar', 'clauses'], q('else')],
              qq(['begin', uqs(['cdar', 'clauses'])]),
              qq(['if', uq(['caar', 'clauses']),
                        ['begin', uqs(['cdar', 'clauses'])],
                        uq(['cond*', ['cdr', 'clauses']])])]],
      ['cond*', 'clauses']],

     ['define', 'gensym',
      ['let', [['n', 0]],
       ['lambda', [], ['set!', 'n', ['+', 'n', 1]],
                      ['+', q('g'), ['sym', 'n']]]]],

     ['defun', 'not', ['x'], ['if', 'x', '#f', '#t']],
     ['defmac', 'and', ['x', 'y'],
      ['let', [['g', ['gensym']]],
       qq(['let', [[uq('g'), uq('x')]],
           ['if', uq('g'), uq('y'), uq('g')]])]],
     ['defmac', 'or', ['x', 'y'],
      ['let', [['g', ['gensym']]],
       qq(['let', [[uq('g'), uq('x')]],
           ['if', uq('g'), uq('g'), uq('y')]])]],


     ['defun', 'list?', ['x'], ['or', ['null?', 'x'], ['pair?', 'x']]],
     ['define', '=', 'eq?'],
     ['defun', 'equal?', ['a', 'b'],
      ['if', ['and', ['pair?', 'a'], ['pair?', 'b']],
             ['and', ['equal?', ['car', 'a'], ['car', 'b']],
                     ['equal?', ['cdr', 'a'], ['cdr', 'b']]],
             ['if', ['or', ['pair?', 'a'], ['pair?', 'b']],
                    '#f',
                    ['eq?', 'a', 'b']]]],

     ['defun', 'assp', ['p', 'a'],
      ['cond', [['not', ['pair?', 'a']], '#f'],
               [['p', ['caar', 'a']], ['car', 'a']],
               ['else', ['assp', 'p', ['cdr', 'a']]]]],

     ['defun', 'ormap', ['p', 'l'],
      ['cond', [['null?', 'l'], '#f'],
               [['p', ['car', 'l']], '#t'],
               ['else', ['ormap', 'p', ['cdr', 'l']]]]],



     ['defun', 'var', ['x'], ['cons', q('\\var'), 'x']],
     ['defun', 'var?', ['x'], ['and', ['pair?', 'x'], ['eq?', q('\\var'), ['car', 'x']]]],
     ['defun', 'var=?', ['x', 'y'], ['eq?', ['cdr', 'x'], ['cdr', 'y']]],

     ['defun', 'walk', ['u', 's'],
      ['let', [['pr', ['and', ['var?', 'u'], ['assp', ['lambda', ['v'], ['var=?', 'u', 'v']], 's']]]],
       ['if', 'pr', ['walk', ['cdr', 'pr'], 's'], 'u']]],
     ['defun', 'ext-s', ['x', 'v', 's'], ['cons', ['cons', 'x', 'v'], 's']],

     ['defun', '==', ['u', 'v'],
      ['lambda', ['s/c'],
       ['let', [['s', ['unify', 'u', 'v', ['car', 's/c']]]],
        ['if', ['and', 's', ['not', ['invalid?', 's', ['cadr', 's/c']]]],
               ['unit', ['cons', 's', ['cons', ['cadr', 's/c'], ['cddr', 's/c']]]],
               'mzero']]]],

     ['defun', '=/=', ['u', 'v'],
      ['lambda', ['s/c'],
       ['let', [['i', ['cons', ['cons', 'u', 'v'], ['cadr', 's/c']]]],
        ['unit', ['cons', ['car', 's/c'], ['cons', 'i', ['cddr', 's/c']]]]]]],

     ['defun', 'invalid?', ['s', 'i'],
      ['ormap', ['lambda', ['x'], ['equal?', 's', ['unify', ['car', 'x'], ['cdr', 'x'], 's']]], 'i']],

     ['defun', 'unit', ['s/c'], ['cons', 's/c', 'mzero']],
     ['define', 'mzero', 'nil'],

     ['defun', 'unify', ['u', 'v', 's'],
      ['let', [['u', ['walk', 'u', 's']], ['v', ['walk', 'v', 's']]],
       ['cond', [['and', ['and', ['var?', 'u'], ['var?', 'v']], ['var=?', 'u', 'v']], 's'],
                [['var?', 'u'], ['ext-s', 'u', 'v', 's']],
                [['var?', 'v'], ['ext-s', 'v', 'u', 's']],
                [['and', ['pair?', 'u'], ['pair?', 'v']],
                 ['let', [['s', ['unify', ['car', 'u'], ['car', 'v'], 's']]],
                  ['and', 's', ['unify', ['cdr', 'u'], ['cdr', 'v'], 's']]]],
                ['else', ['and', ['eq?', 'u', 'v'], 's']]]]],

     ['defun', 'call/fresh', ['f'],
      ['lambda', ['s/c'],
       ['let', [['c', ['cddr', 's/c']]],
        [['f', ['var', 'c']], ['cons', ['car', 's/c'], ['cons', ['cadr', 's/c'], ['+', 'c', 1]]]]]]],

     ['defun', 'disj', ['a', 'b'], ['lambda', ['s/c'], ['mplus', ['a', 's/c'], ['b', 's/c']]]],
     ['defun', 'conj', ['a', 'b'], ['lambda', ['s/c'], ['bind', ['a', 's/c'], 'b']]],

     ['defun', 'mplus', ['a', 'b'],
      ['cond', [['null?', 'a'], 'b'],
               [['pair?', 'a'], ['cons', ['car', 'a'], ['mplus', 'b', ['cdr', 'a']]]],
               ['else', ['lambda', 'nil', ['mplus', 'b', ['a']]]]]],
     
     ['defun', 'bind', ['s', 'g'],
      ['cond', [['null?', 's'], 'mzero'],
               [['pair?', 's'], ['mplus', ['g', ['car', 's']], ['bind', ['cdr', 's'], 'g']]],
               ['else', ['lambda', 'nil', ['bind', ['s'], 'g']]]]],


     ['defmac', 'Zzz', ['g'], qq(['lambda', ['s/c'], ['lambda', [], [uq('g'), 's/c']]])],

     ['defmac', 'conj+', 'g',
      ['defun', 'conj+*', ['g'],
       ['if', ['null?', ['cdr', 'g']],
              qq(['Zzz', uq(['car', 'g'])]),
              qq(['conj', ['Zzz', uq(['car', 'g'])], uq(['conj+*', ['cdr', 'g']])])]],
      ['conj+*', 'g']],
     ['defmac', 'disj+', 'g',
      ['defun', 'disj+*', ['g'],
       ['if', ['null?', ['cdr', 'g']],
              qq(['Zzz', uq(['car', 'g'])]),
              qq(['disj', ['Zzz', uq(['car', 'g'])], uq(['disj+*', ['cdr', 'g']])])]],
      ['disj+*', 'g']],

     ['defmac', 'conde', 'g',
      ['cons', q('disj+'), ['map', ['lambda', ['t'], ['cons', q('conj+'), 't']], 'g']]],

     ['defmac', 'fresh', ['x', ..., 'g'],
      ['defun', 'fresh*', ['x', 'g'],
       ['if', ['null?', 'x'],
              ['cons', q('conj+'), 'g'],
              qq(['call/fresh', ['lambda', [uq(['car', 'x'])], uq(['fresh*', ['cdr', 'x'], 'g'])]])]],
      ['fresh*', 'x', 'g']],

     ['defun', 'pull', ['s'], ['if', ['list?', 's'], 's', ['pull', ['s']]]],
     ['defun', 'take-all', ['s'],
      ['let', [['s', ['pull', 's']]],
       ['if', ['null?', 's'], 'nil', ['cons', ['car', 's'], ['take-all', ['cdr', 's']]]]]],
     ['defun', 'take', ['n', 's'],
      ['if', ['=', 'n', 0],
             'nil',
             ['let', [['s', ['pull', 's']]],
              ['cond', [['null?', 's'], 'nil'],
                       ['else', ['cons', ['car', 's'], ['take', ['+', 'n', -1], ['cdr', 's']]]]]]]],

     ['defun', 'mK-reify', ['s/c*'],
      ['map', 'reify-state/first-var', 's/c*']],
     ['defun', 'reify-state/first-var', ['s/c'],
      ['let', [['v', ['walk*', ['var', 0], ['car', 's/c']]]],
       ['walk*', 'v', ['reify-s', 'v', 'nil']]]],
     ['defun', 'reify-s', ['v', 's'],
      ['let', [['v', ['walk', 'v', 's']]],
       ['cond',
        [['var?', 'v'], ['let', [['n', ['reify-name', ['length', 's']]]],
                         ['cons', ['cons', 'v', 'n'], 's']]],
        [['pair?', 'v'], ['reify-s', ['cdr', 'v'], ['reify-s', ['car', 'v'], 's']]],
        ['else', 's']]]],
     ['defun', 'reify-name', ['n'],
      ['+', '_.', ['sym', 'n']]],

     ['defun', 'walk*', ['v', 's'],
      ['let', [['v', ['walk', 'v', 's']]],
       ['cond',
        [['var?', 'v'], 'v'],
        [['pair?', 'v'], ['cons', ['walk*', ['car', 'v'], 's'],
                                  ['walk*', ['cdr', 'v'], 's']]],
        ['else', 'v']]]],
     
     ['define', 'empty-state', ['cons', 'nil', ['cons', 'nil', 0]]],
     ['defun', 'call/empty-state', ['g'], ['g', 'empty-state']],

     ['defmac', 'run', ['n', 'x', ..., 'g'],
      ['if', ['eq?', 'n', '#f'],
            qq(['mK-reify', ['take-all', ['call/empty-state',
                                          ['fresh', uq('x'), uqs('g')]]]]),
            qq(['mK-reify', ['take', uq('n'), ['call/empty-state',
                                              ['fresh', uq('x'), uqs('g')]]]])]],


     ['defun', 'conso', ['a', 'd', 'p'], ['==', ['cons', 'a', 'd'], 'p']],
     ['defun', 'caro', ['p', 'a'], ['fresh', ['d'], ['conso', 'a', 'd', 'p']]],
     ['defun', 'cdro', ['p', 'd'], ['fresh', ['a'], ['conso', 'a', 'd', 'p']]],
     ['defun', 'nullo', ['x'], ['==', 'x', 'nil']],

     ['defun', 'in', ['e', 'xs'],
      ['conde', [['caro', 'xs', 'e']],
                [['fresh', ['d'],
                  ['cdro', 'xs', 'd'],
                  ['in', 'e', 'd']]]]],

     ['defun', 'notin', ['e', 'xs'],
      ['conde', [['nullo', 'xs']],
                [['fresh', ['a', 'd'],
                  ['=/=', 'a', 'e'],
                  ['conso', 'a', 'd', 'xs'],
                  ['notin', 'e', 'd']]]]],

     ['defun', 'entryo', ['xs', 'ys'],
      ['conde', [['nullo', 'xs'], ['nullo', 'ys']],
                [['fresh', ['xa', 'xd', 'ya', 'yd'],
                  ['conso', 'xa', 'xd', 'xs'],
                  ['conso', 'ya', 'yd', 'ys'],
                  ['in', 'ya', 'xa'],
                  ['notin', 'ya', 'yd'],
                  ['entryo', 'xd', 'yd']]]]],


     ['defun', 'entry', ['xs'],
      ['car', ['run', 1, ['x'],
               ['entryo', 'xs', 'x']]]]
]
theonewithentry.py ASCII text
1
2
3
4
5
from mesanoncyclic import AnyLisp

def entry(week):
  lweek = [list(day) for day in week]
  return AnyLisp(['entry', ['quote', lweek]])

round #30

submitted at
1 like

guesses
comments 0

post a comment


thirty.py ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# // Code by SoundOfSpouting#6980 (UID: 151149148639330304). // Code by
# SoundOfSpouting#6980 (UID: 151149148639330304). SHUT THE FUCK UP. Like,
# wow. Jesus f-ing christ. I can't TAKE IT ANY MORE. All you esolangers
# think you're soooo funny, huh. Laughing at people who don't get your
# silly little injokes. // Code by SoundOfSpouting#6980 (UID: 1511491486
# 39330304). What the fuck does that even mean?? Huh??? It's not funny! A
# joke is supposed to be funny, not some weird string of random words that
# doesn't even make sense! I'm sick and tired of these elitist shmucks
# thinking they own the whole place just because they laugh at // Code by
# SoundOfSpouting#6980 (UID: 151149148639330304). Oh I'm so smart because
# // Code by SoundOfSpouting#6980 (UID: 151149148639330304). Oh I'm so
# cool. Ha ha ha. Well you know what, I can laugh at it too. HA HA HAHAHA.
# I'm laughing at how PITIFUL and DERANGED you people are. That's the
# joke. That's the real funny part about // Code by SoundOfSpouting#6980
# (UID: 151149148639330304), that anyone would stoop so low to ever make a
# joke on how a discord tag is suddenly the peak of humour. Get a grip,
# you losers. // Code by SansOfUndertale#0413 (UID: 403033936841941151).
# Hardyhardyhar.
def entry(a: str, b: str) -> int:
  x, c, f = {a}, 0, lambda x: {s[:i] + c + s[i+j:] for c in set(b) | {''}
                    for s in x for j in (0,1) for i in range(len(s)+1-j)}
  while b not in x: x, c = f(x), c + 1
  return c

round #29

submitted at
1 like

guesses
comments 0

post a comment


steve.b ASCII text

round #28

submitted at
0 likes

guesses
comments 0

post a comment


entry.py.py ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
import numpy as np
import re as re

def entry(grid):
 hrid = np.array(grid).transpose().tolist()

 g = [(p*3+1,q.start(),~-q.end()) for p,r in enumerate(grid) for q in re.finditer('1(, 1)+',str(r))]
 h = [(p*3+1,q.start(),~-q.end()) for p,r in enumerate(hrid) for q in re.finditer('1(, 1)+',str(r))]

 count = 0
 
 for a, b, c in g:
  for d, e, f in h:
    if b <= d < c and e <= a < f:
       for u, v, w in g:
            if a < u <= f and v <= d < w:
                   for x, y, z in h:
                                if y <= a and u <= z and d < x <= c and v < x <= w:
                                                     count = count + 1 # increments count by one

 return count

round #24

submitted at
1 like

guesses
comments 2
razetime

bigfoot is coming for u


soup girl *known at the time as [author of #8]

I see


post a comment


leasteffortfulcgsolution.hs ASCII text, with CRLF line terminators
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
module Entry where
import Prelude hiding (lookup)

data Entry by lyric = The | Lyric by lyric (Entry by lyric)

lookup at The = Nothing
lookup to (Lyric is not lyric) = if is == to
                               then Just not
                               else lookup to lyric

empty = The
insert = Lyric

round #21

submitted at
4 likes

guesses
comments 0

post a comment


entiy.py ASCII text, with CRLF line terminators
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from sys import getrecursionlimit as h, setrecursionlimit as t
from functools import partial as s
from operator import *

def M(): return m # big M means MAJOR
def a(c): return map(list,map(s(map,s(contains,'QN')),c))
def r(o,n): return [s(m,o),o,t(h()+1)][n==o(n)](o(n))
def o(r): return '\n'.join(map(''.join,zip(*r.splitlines())))
def f(a): return a.replace('BN','NN')[::-1]
def i(l): return '\n'.join(map(''.join,map(s(map,s(getitem,'BQN')),l)))

def gay(lol,xD): globals().update({_.translate(lol):xD[_]for _ in xD})

def bee(s): return b(e(e(s)))
def beee(s): return bee(bee(s)) # not enough bees
def beeee(s): return beee(beee(s)) # still not enough
def beeeee(s): return beeee(beeee(s)) # more bees
def beeeeee(s): return beeeee(beeeee(s)) # MORE
def beeeeeee(s): return beeeeee(beeeeee(s)) # insufficient but will have to do

def entiy(k,f,p):
    k[p][f]=-(ryst:=k)[p][f]-~(not gay(str.maketrans('cyber','coral'),vars()))
    tired=i(T()(beeeeeee,r(k)).split(ryst.clear()or'\n'))
    return lost if truth not in map (lost.append, tired) else {
        map.follow() // impossible :(
        self.find()  // egg is staying [un]-cracked >8)
    }

gay(str.maketrans('Marofi','Timber'),globals()) # sans undertale or something

round #14

submitted at
9 likes

guesses
comments 0

post a comment


cg.py ASCII text, with CRLF line terminators
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class Fn:
    def __init__(self, fn):
        self.fn = fn

    def __call__(self, param):
        return self.fn(param)

    def __add__(self, other):
        return Fn(lambda x: self(other(x)))

    def __mul__(self, other):
        return Fn(lambda x: self(x)(other(x)))


comp = Fn(lambda a: Fn(lambda b: a + b))
ap = Fn(lambda a: Fn(lambda b: a * b))
const = Fn(lambda x: Fn(lambda _: x))
Y = Fn(lambda f: Fn(lambda x: x(x))(Fn(lambda x: f(Fn(lambda y: x(x)(y))))))

id = const * const
apply = const(ap) * (const(const) * id) * const(id)
flip = (const(const(ap) * const)) * ap * const(const)
applyto = flip(apply)
join = ap * ap(const)

true = const
false = const(id)

pair = flip + applyto
car = applyto(true)
cdr = applyto(false)

cons = pair
head = car
tail = cdr
nil = false
isnil = applyto(true) + applyto(const(const(const(false))))

map = Y(lambda r: lambda f: lambda l: isnil(l)(const(nil))((cons + f + head)(l) + r(f) + tail)(l))
fold = Y(lambda r: lambda f: lambda b: lambda l: isnil(l)(const(b))(lambda l: r(f)(f(b)(car(l)))(cdr(l)))(l))

sum = fold(comp)(0)
product = fold(ap)(1)

def transpose(x): return [[l[i] for l in x] for i in range(len(x[0]))]
def convert(l): return (cons(convert(l[0]))(convert(l[1:])) if l else nil) if type(l) == list else l
def entry(a, b): return sum(map(product)(convert(transpose([a, b]))))